﻿using QuanLySieuThi.Controllers;
using QuanLySieuThi.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace QuanLySieuThi.Views
{
    public partial class frmLogin : Form
    {
        QuanLyNhanVien qlNhanVien = QuanLyNhanVien.UniqueObject;
        public static NhanVien userLogin = null;
        public frmLogin()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            frmMain.userLogin = qlNhanVien.CheckLogin(textBox1.Text, textBox2.Text);
            if (frmMain.userLogin != null)
                this.DialogResult = DialogResult.OK;
            else
                MessageBox.Show("Đăng nhập ko thành công!");
        }

        private void frmLogin_Load(object sender, EventArgs e)
        {
          //  qlNhanVien.LoadData();

            Helper<Models.ChucVu> h = new Helper<Models.ChucVu>();
            List<Models.ChucVu> l = new List<Models.ChucVu>();
            Models.DataAccess db = new Models.DataAccess();
            l = h.TableToList(db.ExecuteQuery("select * from ChucVu"));
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }


    }
}
